<template>
  <div class="mine">
    <van-card
      v-for="l in lessonsList"
      :key="l"
      :price="l.price"
      :title="l.title"
      :thumb="l.poster"
    >
      <template #tags>
        <van-tag plain>
            {{formateCategory(l.category)}}
        </van-tag>
      </template>
    </van-card>
  </div>
</template>

<script lang='ts'>
import { ILessons } from '@/typings/home';
import { defineComponent, PropType } from 'vue';

export default defineComponent({
  props: {
    lessonsList: {
      type: Array as PropType<ILessons[]>,
    },
  },
  setup() {
    //    格式化分类标签
    function formateCategory(type:number){
        switch (type) {
            case 1:
                return 'react课程'
                break;
            case 2:
                return 'Vue课程'
                break;
        
            default:
                break;
        }
    }
    return {
        formateCategory
    }
  },
});
</script>

<style lang="scss" scoped>
</style>